#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

//int main(int argc, char *argv[])
int main()
{
    //umask(0);
    //int fd1 = open("log.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd1 = open("log.txt1", O_WRONLY | O_CREAT, 0666);
    int fd2 = open("log.txt2", O_WRONLY | O_CREAT, 0666);
    int fd3 = open("log.txt3", O_WRONLY | O_CREAT, 0666);
    int fd4 = open("log.txt4", O_WRONLY | O_CREAT, 0666);
    if(fd1 < 0)
    {
        perror("open");
        return 1;
    }

    printf("fd1: %d\n", fd1);
    printf("fd1: %d\n", fd2);
    printf("fd1: %d\n", fd3);
    printf("fd1: %d\n", fd4);
    //const char *message = "helloworld\n";
    const char *message = "xxxxx\n";
    write(fd1, message, strlen(message));

    close(fd1);

    return 0;
}